var t, e = require("../../@babel/runtime/helpers/defineProperty"), a = (t = require("../../utils/http.js")) && t.__esModule ? t : {
    default: t
};

Component({
    properties: {
        item: {
            type: Object,
            value: {}
        }
    },
    data: {},
    methods: {
        edit_cart_num: function(t) {
            var e = this, r = t.currentTarget.dataset.type, i = t.currentTarget.dataset.id, n = t.currentTarget.dataset.crid;
            this.setData({
                type: r
            });
            a.default.request("/product/edit_cart_num", {
                type: r,
                id: n
            }).then(function(t) {
                200 == t.code ? e.triggerEvent("cartnumnhange", {
                    id: i,
                    num: t.data,
                    crid: n
                }) : wx.showToast({
                    title: t.msg,
                    icon: "none"
                });
            }).catch(function(t) {});
        },
        set_cart: function(t) {
            var r = this, i = t.currentTarget.dataset.id;
            this.setData({
                id: i
            }), a.default.request("/product/set_cart", {
                id: this.data.id
            }).then(function(t) {
                if (200 == t.code) {
                    r.setData(e(e({}, "item.crnum", t.data.crnum), "item.crid", t.data.crid)), r.triggerEvent("cartAdd"), 
                    wx.showToast({
                        title: t.msg
                    });
                }
            }).catch(function(t) {});
        }
    }
});